<template>
  <div class="container page">

   <div v-if="isApply" style="margin:50rpx;text-align:center">
       <!-- <p>普通用户消费达到3800元,即可申请成为我们的高级合伙人,享受高级合伙人权益</p> -->
       <p>普通用户消费达到3800元</p>
       <p>即可申请成为我们的高级合伙人</p>
       <p>享受高级合伙人权益</p>


        <p style="margin-top:100rpx"></p>
        <div style="background-color: #fff">
            <input style="background-color: #e6e6e6;margin:20rpx;height:80rpx" type="text" placeholder="填写姓名" class="yzm" v-model="form.name"/>

            <input style="background-color: #e6e6e6;margin:20rpx;height:80rpx" type="text" placeholder="填写手机号" class="yzm" v-model="form.phonenub"/>

            <input style="background-color: #e6e6e6;margin:20rpx;height:80rpx" type="text" placeholder="填写微信号" class="yzm" v-model="form.wxh"/>

            <input style="background-color: #e6e6e6;margin:20rpx;height:80rpx" type="text" placeholder="填写身份证号码" class="yzm" v-model="form.sfz"/>
       </div>
       <div style="width:100%">
           <p style="margin-top:100rpx"></p>
           <p style="margin:0 150rpx;background-color:#000;color:#fff;height:80rpx;line-height:80rpx;" @click="submit">提交表格</p>
       </div>
   </div>
   <div v-if="!isApply" style="margin:50rpx;text-align:center">
        <p style="margin-top:350rpx"></p>
        <p>合伙人申请审核中</p>
   </div>


  </div>
</template>
<script>
// var WXBizDataCrypt = require('@/tools/WXBizDataCrypt')
import qcloud from 'wafer2-client-sdk'

import {showSuccess, showModal} from '@/util'
import {get, post, getAuth} from '@/util'
// import {get2, post2} from '@/server/api'
import config from '@/config'
export default {

  data () {
    return {
      isApply: false,
      form: {"name":"","phonenub":"","wxh":"","sfz":""},
      shippingInfo: {},
      shippingid: '',
      tabA: 0,
      listIncome: [{
          SalesBalance: 0,
          profit: 0}],
      focus: true,
      inputValue: ''
    }
  },
  mounted () {
    this.userinfo = wx.getStorageSync('userinfo')
  },
  onShareAppMessage() {
    return {
      title: `华人耀酱香型白酒，传承古法工艺，与国酒茅台同宗同源同品。`,
      // imageUrl: 'https://www.rrjiaoyi.com/static/rr-min/share/share.png',
      path: `/pages/hcdindex/main?shareuser=${wx.getStorageSync('user').id}`
    }
  },
  methods: {
      submit(){
        getAuth(`geweb/partner/insertUserId?userId=${JSON.parse(wx.getStorageSync('user').id)}&mingzi=${this.form.name}&shouji=${this.form.phonenub}&weixin=${this.form.wxh}&shenfenzheng=${this.form.sfz}`, {}, {}).then(result => {

            console.log(result)

            if(result.message !== "申请成为合伙人提交成功") {

                wx.showToast({
                  title: '请填写正确信息',
                  icon: 'none'
                })
            }

            if(result.message === "申请成为合伙人提交成功") {

              wx.switchTab({
                url: `/pages/usercenter/main`
              })

            }
            // if(result.code === 301) {

            // }

        })
      },
      async apply(){
        return await getAuth(`geweb/partner/selectUserId?userId=${JSON.parse(wx.getStorageSync('user').id)}`, {}, {}).then(result => {

            if(result.res === "0") {
                console.log(result.res)
                this.isApply = false
            }

            if(result.res === "1") {
                console.log(result.res)
                this.isApply = true
            }
            // if(result.code === 301) {

            // }

        })
      },
    async get_listincome() {
      return await getAuth(`geweb/partner/listIncome?userId=${JSON.parse(wx.getStorageSync('user').id)}`, {}, {}).then(result => {

        if(result.code === 301) {
          // wx.hideLoading();
          // console.log("去登陆")
          wx.switchTab({
            url: `/pages/usercenter/main`
          })
          wx.showToast({
            title: '请登录',
            icon: 'none'
          })
        }

        if(result.code === 200) {
            console.log(result.res)
            this.listIncome = result.res;
            // wx.hideLoading();
        }
      })
    },
    payment() {
      wx.navigateTo({
        url: `/pages/partnerpayment/main`
      })
    },
    earning() {
      wx.navigateTo({
        url: `/pages/partnerOrderEarning/main`
      })
    },
    productChoose (id) {
      // console.log(name, img, userId, accountId)
      wx.navigateTo({
        url: `/pages/product-detail/main?id=${id}`
      })
    },
    async player() {
      return await post('minipro/List', {}, {'api':'all', 'page':1})
    },
    async demo() {
    // return await get2('demo', {})
    },
    async joke() {
      return await get2('api/jokes', {})
    },
    predict () {
      wx.navigateTo({
        url: '/pages/search/main'
      })
    },
    jumpClick (comment) {
      wx.navigateTo({
        // url: '/pages/web-view/main'
        url: '/pages/web-view/main?path=' + 'https://wj.qq.com/s/2491547/f457/'
        // url: '/pages/detail/main'
      })
    }

  },
  onShow () {
    this.apply()
  }
}
</script>

<style scoped lang='scss'>
.container{
  font-size: 30rpx;
}
page {
  background-color: #ffffff;
  width: 100%;
  height: 100%;
}
.tz{
        text-align: center;
        margin-top: 20px;
        margin-bottom:60px;
    }
    .xsrh{
        text-align: center;
        margin-top: 50px;
    }
    .y{
        text-align: center;
        margin-top: 50rpx;
        font-size: 60rpx;
    }
    .b{
        text-align: center;
    }
    .b1{
        margin-top: 40px;
        margin-right: 20px;
        height: 30px;
        line-height: 30px;
        width: 80px;
        border-radius: 5px;
        background: #C8D3D1;
    }
    .b2{
        font-size: 30rpx;
        margin-top: 50rpx;
        height: 30px;
        line-height: 30px;
        width: 30%;
        border-radius: 5px;
        background: #C8D3D1;
    }
    .fgx{
        text-align: center;
        margin-top: 40px;
        background: #C8D3D1;
        width: 92%;
        height: 10px;
        margin-left: 4%;
    }
    .ys{
        text-align: center;
        margin-top: 10px;
        margin-left: 20px;
    }
    .syxq{
        color: red;
        font-size: 5px;
        margin-left: 20px;
    }
</style>
